import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import uView from '@/uni_modules/uview-ui'
import http from "utils/http.js"
import utils from './utils/utils.js'
import { API_URL, BASE_URL } from './env.js'
const jumpdetail = (url, val) => {
	uni.navigateTo({
		url: url + val
	})
}
const jumpurl = (url) => {
	uni.navigateTo({
		url: url
	})
}
const callphone = (p) => { //拨打电话
	console.log("拨打电话");
	uni.makePhoneCall({
		phoneNumber: p.toString()
	}).catch((e) => {
		// console.log(e)  //用catch(e)来捕获错误{makePhoneCall:fail cancel}
	})
}
const lbtpriview = (index, arr) => { //预览图片
	console.log("预览图片");
	var i = arr; //获取当前页面的轮播图数据
	//uniapp预览轮播图
	uni.previewImage({
		current: index, //预览图片的下标
		urls: i //预览图片的地址，必须要数组形式，如果不是数组形式就转换成数组形式就可以
	})
}
console.log(API_URL, BASE_URL, 'BASE_URL')
Vue.prototype.$API_URL = API_URL
Vue.prototype.$IMG_URL = BASE_URL
Vue.prototype.http = http
Vue.prototype.jumpdetail = jumpdetail
Vue.prototype.jumpurl = jumpurl
Vue.prototype.lbtpriview = lbtpriview
Vue.prototype.callphone = callphone
Vue.use(uView)
Vue.use(utils)
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  ...App
})

app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif